# -*- coding: utf-8 -*-

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from ui.news import Ui_Form

class NewsWidget(QWidget):
	def setup(self):
		self.ui = Ui_Form()
		self.ui.setupUi(self)

	def __init__(self,title,update,summary,link,parent = None):
		super(NewsWidget, self).__init__(parent)
		self.setup()
		self.link = link
		#--Set News Attributes---#
		self.setTitle(title)
		self.setSummary(summary,update)
		#------------------------#

	def setTitle(self,title):
		self.ui.dockWidget.setWindowTitle(unicode(title))

	def setSummary(self,summary,update):
		text = update + "<br><br>" + summary
		self.ui.lblSummary.setText(unicode(text))

	def mouseDoubleClickEvent(self,evt):
		self.emit(SIGNAL("doubleClickNews(PyQt_PyObject)"),self.link)